<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>控制器中使用filter过滤器服务 </title>
		<script src="../org/angular.min.js" ></script>
	</head>
	<body>
		<div ng-app = "hd" ng-controller = "ctrl">
			搜索：<input type="text" ng-model="select" />
			<table border="1" width="660px">
				<tr>
					<td>编号</td>
					<td>年龄</td>
					<td>链接</td>
				</tr>
				<tr ng-repeat='v in lists'>
					<td>{{v.id}}</td>
					<td>{{v.age}}</td>
					<td>{{v.url}}</td>
				</tr>
			</table>
		</div> 
		<script>
			var m = angular.module('hd',[]);
			m.controller('ctrl',['$scope','$filter',function($scope,$filter){
				$scope.data = [{id:1,age:100,url:"www.scb"},
				{id:2,age:200,url:"www.baidu"},
				{id:3,age:300,url:"www.jd.com"}
				];
				
				$scope.select = "";
				$scope.lists = $scope.data;
				$scope.$watch("select",function(n,o){
					$scope.lists = $filter('filter')($scope.data,n);
				})
			}]);
		</script>
	</body>
</html>
